package Utils;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class QuestionDialog extends JDialog {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	JList lst;
	JTextField tf;
	Container cp;

	public QuestionDialog(JFrame fr, String title) {
		super(fr, title, false);
		cp = getContentPane();
		DefaultListModel mod = new DefaultListModel();
		lst = new JList(mod);
		lst.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		tf = new JTextField(25);
		setSize(350, 200);
		cp.setLayout(new FlowLayout());
		cp.add(lst);
		cp.add(tf);
		addWindowListener(new WA());
	}

	int getlst() {
		return lst.getSelectedIndex();
	}

	String gettf() {
		return tf.getText();
	}

	class WA extends WindowAdapter {
		public void windowClosing(WindowEvent ev) {
			setVisible(false);
		}
	}
}
